﻿using System;
using System.Windows.Data;
using TopBuilds.Restaurant.Data;

namespace TopBuilds.Restaurant.ViewModel
{
    public class DiscountOptionValueConverter : IValueConverter
    {
        /// <summary>
        /// Convert Privilege Id to its name
        /// </summary>
        /// <param name="value">Binding Privilege Id</param>
        /// <param name="targetType">Ignore</param>
        /// <param name="parameter">Ignore</param>
        /// <param name="culture">Ignore</param>
        /// <returns></returns>
        object IValueConverter.Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            DiscountOption p = DiscountOptionObject.GetDiscountOption(Convert.ToInt32(value.ToString()));
			if(p != null)
			{
               return p.Name;
			}

            return null;
        }

        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
